// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import UIKit

// FXIOS-10189 This struct will be refactored into a generic UITableView solution later. For now, it is largely a clone of
// MenuKit's work. Eventually both this target and the MenuKit target will leverage a common reusable tableView component.
public struct SearchEngineElement: Equatable {
    let title: String
    let image: UIImage
    let a11yLabel: String
    let a11yHint: String?
    let a11yId: String
    public let action: (() -> Void)?

    // We need this init as by default the init generated by the compiler for the struct will be internal and cannot be used
    // outside of this target
    public init(
        title: String,
        image: UIImage,
        a11yLabel: String,
        a11yHint: String?,
        a11yId: String,
        action: (() -> Void)?
    ) {
        self.title = title
        self.image = image
        self.a11yLabel = a11yLabel
        self.a11yHint = a11yHint
        self.a11yId = a11yId
        self.action = action
    }

    public static func == (lhs: SearchEngineElement, rhs: SearchEngineElement) -> Bool {
        return lhs.title == rhs.title &&
        lhs.image == rhs.image &&
        lhs.a11yLabel == rhs.a11yLabel &&
        lhs.a11yHint == rhs.a11yHint &&
        lhs.a11yId == rhs.a11yId
    }
}
